// JavaScript Document
$(document).ready(function(e) {
    $('#btnchonanh').click(function(e) {
		$('#ufile').click();
	});
	$('#ufile').change(function(e) {
		$('#loading').show();
		$('#avatar').hide();
		$('#frmUpload').submit();
	});
	document.getElementById('frmTV').onsubmit = function() {
		if($('#linkhinh').val()!="") return true;
		else{
		 showMessage('warning');
		 return false;
		}
	}
});
function uploaded(path){
	if(path != "0"){
		$('#avatar').show();
		$('#loading').hide();
	  document.getElementById('avatar').src = path;
	  $('#linkhinh').val(path);
	  hideAllMessages();
	  cansubmit=true;
	}
	else{
		showMessage('error');
	}
}